from selenium import webdriver



# 创建浏览器对象
browser = webdriver.Edge()
url="http://www.baidu.com"
browser.get(url)
print(browser.title)
import time
time.sleep(3)
input = browser.find_element('id',"kw")
input.send_keys("周杰伦")
time.sleep(3)
button = browser.find_element("id", "su")
button.click()
time.sleep(3)
#滑到底部
browser.execute_script("window.scrollTo(0,document.body.scrollHeight)")
browser.save_screenshot("baidu.png")
time.sleep(3)
button_page = browser.find_element('xpath', '//a[@class="n"]')
button_page.click()
time.sleep(3)
browser.back()
time.sleep(3)
browser.forward()
time.sleep(3)
browser.quit()